**************************************************************
** title:		How Group Appeals Shape Candidate Support 	**
** purpose: 	replication pilot							**
** date:		march 2025 									**
** machine:		macOS Sonoma 14.4							**
** software:	Stata 18.0 									**	
**************************************************************


* --------------
* preamble
* --------------

	** install packages (if note installed yet)
	*ssc install mplotoffset

	** set working directory first (modify to your directory)
	cd "~/dropbox/symbolic group appeals project/replication materials/data"

	** load dataset	
	use  "pilot.dta", clear	
	
	** working directory for saving tables and figures 	
	cd "~/dropbox/symbolic group appeals project/replication materials/tables and figures"
	
	** set style for graphs
	grstyle init
	grstyle set plain, nogrid noextend		
	

* -----------------------------------	
* appendix H, pilot study results	
* -----------------------------------	

	** compare simple and contrasting class vignette effects (classtreatment : 1 = "vignette with contrast" ; 2 = "simple vignette")
	eststo pilot1: reg candidate_rating_class i.workingclass##i.classtreatment i.labour, robust
	margins, dydx(classtreatment) at(workingclass=(0 1))
	mplotoffset, offset(0.15) recast(scatter) recastci(rspike) xtitle("") xlabel(0 "Not working class" 1 "Working class") title("") ytitle("AME assignment to treatment") ylabel(-2(1)4) legend(nobox cols(2) pos(6) region(col(white)))  xsize(3.5) ysize(2) scale(1.5) yline(0, lpattern(dash)) saving(class-main-vignettetypes.gph, replace)

	** table with estimates underlying Figure H1
	esttab pilot1 using AppendixH_estimates.tex , b(3) se(3) nogap r2 replace	
